
/*

DEPENDENCIES:
-------------
(none)
-------------


IN THIS FILE:
-------------
ext.for_each
-------------

*/

Gimme.ext.for_each = function()
{
	return typeof Array.prototype.forEach !== 'undefined' ? native_forEach : custom_forEach;
	
	function native_forEach(fn, thisObject)
	{
		this.entities().forEach(fn, thisObject);
		return this;
	}
	
	function custom_forEach(fn, thisObject)
	{
		var things = this.entities();
		var i, len = things.length;
		for (i = 0; i < len; i++)
		{
			fn.call(thisObject, things[i], i, things);
		}
		
		return this;
	}	
}();
//[AltSyntax]Gimme.ext.forEach = Gimme.ext.for_each;